﻿using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity;
using Microsoft.Practices.Unity;

namespace WmsService.AOP
{
    public class Global
    {
        private readonly static IUnityContainer Container = null;
        public static IUnityContainer GetIUnityContainer()
        {
            return Container;
        }

        static Global()
        {
            Container = GetContainer();
        }

        static IUnityContainer GetContainer()
        {
            IUnityContainer container = new UnityContainer();
            var configurator = new UnityContainerConfigurator(container);
            EnterpriseLibraryContainer.ConfigureContainer(configurator, ConfigurationSourceFactory.Create());
            container.AddNewExtension<InterceptionExtension>();
            return container;
        }
    }
}